<!-- Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================-->
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
  <link rel="stylesheet" href="./style.css">
  <title>Visualizer</title>
  <style>
    input[type="file"] {
      width: 0;
      height: 0;
      opacity: 0;
      cursor: pointer;
      display: none;
    }
  </style>
</head>
<body>
  <h1>Visualizers</h1>
  <p>
    There are several MIDI or <code>NoteSequence</code> visualizers available.
    You can connect it to an <code>mm.Player</code> to update the visualization
    in sync with the audio.
  </p>

  <section>
    <p>Load a melody in any of these formats:</p>
    <button id="urlBtn">Load URL</button>
    <button id="seqBtn">Load NoteSequence</button>
    <label class="button">
      Load midi file
      <input type="file" id="fileInput">
    </label>
    <br><br>
    <button id="playBtn" disabled>wait...</button>
    <span class="input">
      <b>Tempo:</b>
      <input id="tempoInput" value="100" type="range" min="20" max="240" value="120" step="1">
      <span id="tempoValue"></span>
    </span>
  </section>

  <h2>mm.PianoRollSVGVisualizer</h2>
  <section>
    <div class="visualizer-container">
      <svg id="svg"></svg>
    </div>
  </section>

  <h2>mm.StaffSVGVisualizer</h2>
  <section>
    <div class="visualizer-container">
      <div id="staff"></div>
    </div>
  </section>

  <h2>mm.WaterfallSVGVisualizer</h2>
  <section>
    <label><input type="checkbox" id="waterfallCheckbox">Show only necessary octaves</label>
    <br>
    <div class="visualizer-container">
      <div id="waterfall">
      </div>
    </div>
  </section>

  <h2>mm.PianoRollCanvasVisualizer</h2>
  <section>
    <p>
      <b>Note:</b> This has the same visual output as <code>mm.PianoRollSVGVisualizer</code>,
      but using a canvas instead of an svg. This visualizers also redraws the entire
      sequence on every time step. For longer sequences, canvases become really expensive and
      big, and might crash the renderer.
      We recommend using the <code>PianoRollSVGVisualizer</code>mm.PianoRollSVGVisualizer</code>,
      if performance is a concern.
    </p>
    <div class="visualizer-container">
      <canvas id="canvas"></canvas>
    </div>
  </section>


  <script src="visualizer_bundle.js"></script>
</body>
</html>
